package 乐观锁;

import java.util.concurrent.atomic.AtomicInteger;

public class Main {

    public static void main(String[] args) {
        //定义了源自类
        AtomicInteger  i=new AtomicInteger();
        System.out.println(i.get());
        System.out.println(i.incrementAndGet());
        //对比操作
        i.compareAndExchange(2,2);
        System.out.println(i.get());
        i.set(50);
        System.out.println(i.get());
    }
}
